package com.ming.springcloud.consumer.service;

import com.ming.springcloud.consumer.hystric.DeviceServiceHystric;
import com.ming.springcloud.consumer.vo.Books;
import com.ming.springcloud.consumer.vo.Devices;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "student-service-provider", fallback = DeviceServiceHystric.class)  //服务提供者的名字
public interface DeviceService {

    @RequestMapping(value = "/device/findAllDevices", method = RequestMethod.GET)
    String findAllDevices(@RequestParam(value = "name") String name);

    @RequestMapping(value = "/device/findDevicesById/{id}", method = RequestMethod.GET)
    String findDevicesById(@RequestParam(value = "name") String name, @RequestParam(value = "id") Integer id);

    @RequestMapping(value = "/device/delDevice/{id}", method = RequestMethod.GET)
    String delDevice(@RequestParam(value = "name") String name, @RequestParam(value = "id") Integer id);

    @RequestMapping(value = "/device/editDevice", method = RequestMethod.POST)
    String editDevice(@RequestParam(value = "name") String name, @RequestBody Devices devices);

    @RequestMapping(value = "/device/addDevice", method = RequestMethod.POST)
    String addDevice(@RequestParam(value = "name") String name, @RequestBody Devices devices);
}
